home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 9
/
FM Towns Free Software Collection 9.iso
/
t_os
/
tool
/
wings
/
w2_src
/
filer.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-16
|
21KB
|
679 lines
#include <dos.h>
#include <egb.h>
#include <mos.h>
#include <cdrfrb.h>
#include <direct.h>
#include <string.h>
#include <msdos.cf>
#include "define.h"
#include "module.h"
#include "extend.h"
#include "font_sub.h"
#include "filer.h"
#define BS 8
#define FILER_COL_1 8
#define FILER_COL_2 1
#define FILER_COL_3 2
#define FILER_COL_4 15
#define FILER_COL_5 10
static char f_name[1024][16], f_attr[1024];
static char crr_dir[81];
static int page, fx = 132, fy = 135;
static long file_size[1024];
// ファイルセレクタ関数群
int filer( char *egbwork, char *strptn, int type, char *name, long *s )
{
char key_buff[ 2 ];
int i, j, k, m, n, o, ch, mx, my, flag = 0, not_ready, protect;
int x1, y1, x2, y2, x3, y3, moji, key_mode;
UINT c_drv, d_drv, egb_sel;
struct {
short x1, y1, x2, y2;
} scroll = { fx + 118, fy + 55, fx + 327, fy + 186 };
char drv[ 17 ][ 3 ] = { "A", "B", "C", "D",
"E", "F", "G", "H",
"I", "J", "K", "L",
"M", "N", "O", "P", "Q" };
*name = '\0';
j = k = n = o = *s = 0;
MOS_sleep;
egb_sel = getds( );
page = ( EGB_getWritePage( egbwork, egb_sel ) ) ? PAGE_1 : PAGE_0;
display_filer( egbwork, strptn );
_dos_getdrive( &c_drv );
if( c_drv<=2 ){
disk_status( ( int )c_drv - 1, ¬_ready, &protect );
n = j = k = 0;
if( !not_ready ){
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
}
else if( c_drv==17 ){
i = cdr_status( 0, 0, 0 );
if( !i ){
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
else
n = j = k = 0;
}
else{
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+50, fy+43 ), drv[ c_drv - 1 ], 0 );
MOS_awake;
goto loop;
jump_b: ; ;
display_filer( egbwork, strptn );
_dos_getdrive( &c_drv );
if( flag ){
if( c_drv<=2 ){
disk_status( ( int )c_drv - 1, ¬_ready, &protect );
n = j = k = 0;
if( !not_ready ){
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
}
else if( c_drv==17 ){
i = cdr_status( 0, 0, 0 );
if( !i ){
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
}
else{
get_filename( &n );
put_filename( strptn, &j, &k, n );
}
}
if( *name ){
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_mix( strptn, page, POS( fx+12, fy+146 ), name, 0 );
}
if( type )
line( egbwork, fx+15+o*6, fy+147, fx+15+o*6, fy+156, FILER_COL_5 );
m = 8;
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+50, fy+43 ), drv[ c_drv - 1 ], 0 );
scroll.x1 = fx + 118;
scroll.y1 = fy + 55;
scroll.x2 = fx + 327;
scroll.y2 = fy + 186;
MOS_awake;
loop: ; ;
do {
MOS_rdpos( &ch, &mx, &my );
} while( ch==2 );
if( ch && cmp( mx,fx+40,fx+71 ) && cmp( my,fy+32,fy+63 ) ){
_dos_getdrive( &c_drv );
if( c_drv==17 ){
i = cdr_status( 0, 0, 0 );
if( i )
goto loop;
}
if( c_drv<=2 ){
disk_status( ( int )c_drv - 1, ¬_ready, &protect );
if( not_ready )
goto loop;
}
MOS_sleep;
box( egbwork, fx + 70, fy + 32, fx + 71, fy + 63, FILER_COL_4 );
box( egbwork, fx + 40, fy + 62, fx + 71, fy + 63, FILER_COL_4 );
frame( egbwork, fx + 40, fy + 32, fx + 71, fy + 63, FILER_COL_1 );
frame( egbwork, fx + 41, fy + 33, fx + 71, fy + 63, FILER_COL_1 );
sleep( 10 );
get_filename( &n );
put_filename( strptn, &j, &k, n );
box( egbwork, fx + 40, fy + 32, fx + 71, fy + 33, FILER_COL_4 );
box( egbwork, fx + 40, fy + 32, fx + 41, fy + 63, FILER_COL_4 );
frame( egbwork, fx + 40, fy + 32, fx + 70, fy + 62, FILER_COL_1 );
frame( egbwork, fx + 40, fy + 32, fx + 71, fy + 63, FILER_COL_1 );
MOS_awake;
}
if( ch && n && cmp( mx,fx+344,fx+359 ) && cmp( my,fy+160,fy+175 ) &&
j>=11 ){
MOS_sleep;
button_on( egbwork, fx+344, fy+160, fx+359, fy+175 );
EGB_color( egbwork, 1, FILER_COL_4 );
sleep( 10 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
while( ch==1 && j>=11 ){
EGB_partScroll( egbwork, 1, 0, 12, ( char *)&scroll );
j--;
if( f_attr[ j - k ]==1 ){
font_ank( strptn, page, POS( fx+120, fy+55 ),
"< >", 0 );
font_mix( strptn, page, POS( fx+128, fy+55 ),
f_name[ j-10 ], 0 );
}
else
font_mix( strptn, page, POS( fx+120, fy+55 ),
f_name[ j-10 ], 0 );
font_10( strptn,
page, POS( fx+280, fy+55 ), ( int )file_size[ j - 10 ], 8, 1 );
sleep( 2 );
MOS_rdpos( &ch, 0, 0 );
}
button_off( egbwork, fx+344, fy+160, fx+359, fy+175 );
frame( egbwork, fx+344, fy+160, fx+359, fy+175, FILER_COL_1 );
MOS_awake;
}
if( ch && n && cmp( mx,fx+344,fx+359 ) && cmp( my,fy+176,fy+191 ) &&
n>=j+2 ){
MOS_sleep;
button_on( egbwork, fx+344, fy+176, fx+359, fy+191 );
EGB_color( egbwork, 1, FILER_COL_4 );
sleep( 10 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
while( ch==1 && n>=j+2 ){
EGB_partScroll( egbwork, 1, 0, -12, ( char *)&scroll );
j++;
if( f_attr[ j ]==1 ){
font_ank( strptn, page, POS( fx+120, fy+175 ),
"< >", 0 );
font_mix( strptn, page, POS( fx+128, fy+175 ),
f_name[ j ], 0 );
}
else
font_mix( strptn, page, POS( fx+120, fy+175 ),
f_name[ j ], 0 );
font_10( strptn,
page, POS( fx+280, fy+175 ), ( int )file_size[ j ], 8, 1 );
sleep( 2 );
MOS_rdpos( &ch, 0, 0 );
}
button_off( egbwork, fx+344, fy+176, fx+359, fy+191 );
frame( egbwork, fx+344, fy+176, fx+359, fy+191, FILER_COL_1 );
MOS_awake;
}
if( ch && n && cmp( mx, fx+120, fx+327 ) && cmp( my, fy+55, fy+66+k*12 ) ){
MOS_sleep;
m = ( my - fy - 55 ) / 12;
font_ank_col( FILER_COL_4, FILER_COL_1 );
font_kan_col( FILER_COL_4, FILER_COL_1 );
font_ank( strptn, page, POS( fx+120, fy+55+m*12 ),
" ", 0 );
font_mix( strptn, page, POS( fx+120, fy+55+m*12 ),
f_name[ j-k+m ], 0 );
font_10( strptn,
page, POS( fx+280, fy+55+m*12 ), ( int )file_size[ j-k+m ], 8, 1 );
sleep( 10 );
do{
MOS_rdpos( &ch, 0, 0 );
}while( ch==1 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_ank( strptn, page, POS( fx+120, fy+55+m*12 ),
" ", 0 );
font_mix( strptn, page, POS( fx+120, fy+55+m*12 ),
f_name[ j-k+m ], 0 );
font_10( strptn,
page, POS( fx+280, fy+55+m*12 ), ( int )file_size[ j-k+m ], 8, 1 );
if( f_attr[ j-k+m ]==1 ){
font_ank_col( FILER_COL_4, FILER_COL_4 );
font_ank( strptn, page, POS( fx+12, fy+145 ), " ", 0 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
*name = '\0';
*s = 0;
_chdir( f_name[ j-k+m ] );
box( egbwork, fx+113, fy+25, fx+334, fy+ 38, FILER_COL_4 );
box( egbwork, fx+118, fy+55, fx+327, fy+186, FILER_COL_4 );
if( type )
line( egbwork,fx+15+o*6,fy+147,fx+15+o*6,fy+156,FILER_COL_5 );
sleep( 10 );
m = 8;
get_filename( &n );
put_filename( strptn, &j, &k, n );
MOS_awake;
goto loop;
}
if( f_attr[ j-k+m ]==2 ){
font_ank_col( FILER_COL_4, FILER_COL_4 );
font_ank( strptn, page, POS( fx+12, fy+145 ), " ", 0 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
*name = '\0';
*s = 0;
i = 0;
while( crr_dir[ i ] )
i++;
while( crr_dir[ i ]!='\\' )
i--;
i==2 ? crr_dir[ 3 ] = '\0':crr_dir[ i ] = '\0';
_chdir( crr_dir );
box( egbwork, fx+113, fy+25, fx+334, fy+ 38, FILER_COL_4 );
box( egbwork, fx+118, fy+55, fx+327, fy+186, FILER_COL_4 );
if( type )
line( egbwork,fx+15+o*6,fy+147,fx+15+o*6,fy+156,FILER_COL_5 );
sleep( 10 );
m = 8;
get_filename( &n );
put_filename( strptn, &j, &k, n );
MOS_awake;
goto loop;
}
*name = '\0';
box( egbwork, fx+12, fy+145, fx+100, fy+157, FILER_COL_4 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_mix( strptn, page, POS( fx+12, fy+146 ), f_name[ j-k+m ], 0 );
strcpy( name, f_name[ j-k+m ] );
*s = file_size[ j-k+m ];
if( type )
line( egbwork, fx+15+o*6, fy+147, fx+15+o*6, fy+156, FILER_COL_5 );
MOS_awake;
}
if( ch && cmp( mx, fx+16, fx+31 ) && cmp( my, fy+32, fy+63 ) ){
MOS_sleep;
button_on( egbwork, fx+16, fy+32, fx+31, fy+63 );
box( egbwork, fx+12, fy+145, fx+100, fy+157, FILER_COL_4 );
*name = '\0';
*s = 0;
loop_1: c_drv--;
if( c_drv==3 )
c_drv--;
loop_a: _dos_setdrive( c_drv, &d_drv );
_dos_getdrive( &d_drv );
if( d_drv!=c_drv ){
if( c_drv==0 ){
c_drv = 17;
goto loop_a;
}
c_drv--;
if( c_drv==3 )
c_drv--;
goto loop_a;
}
c_drv = d_drv;
_dos_setdrive( c_drv, &d_drv );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+50, fy+43 ), drv[ c_drv - 1 ], 0 );
sleep( 10 );
button_off( egbwork, fx+16, fy+32, fx+31, fy+63 );
frame( egbwork, fx+16, fy+32, fx+31, fy+63, FILER_COL_1 );
box( egbwork, fx+113, fy+25, fx+334, fy+ 38, FILER_COL_4 );
box( egbwork, fx+118, fy+55, fx+327, fy+187, FILER_COL_4 );
if( type )
line( egbwork, fx+15+o*6, fy+147, fx+15+o*6, fy+156, FILER_COL_5 );
n = flag = 0;
MOS_awake;
}
if( ch && cmp( mx, fx+80, fx+95 ) && cmp( my, fy+32, fy+63 ) ){
MOS_sleep;
button_on( egbwork, fx+80, fy+32, fx+95, fy+63 );
box( egbwork, fx+12, fy+145, fx+100, fy+157, FILER_COL_4 );
*name = '\0';
*s = 0;
loop_2: c_drv++;
if( c_drv==3 )
c_drv++;
loop_b: _dos_setdrive( c_drv, &d_drv );
_dos_getdrive( &d_drv );
if( d_drv!=c_drv ){
c_drv++;
if( c_drv>=18 )
c_drv = 0;
else if( c_drv==3 )
c_drv++;
goto loop_b;
}
c_drv = d_drv;
_dos_setdrive( c_drv, &d_drv );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+50, fy+43 ), drv[ c_drv - 1 ], 0 );
sleep( 10 );
button_off( egbwork, fx+80, fy+32, fx+95, fy+63 );
frame( egbwork, fx+80, fy+32, fx+95, fy+63, FILER_COL_1 );
box( egbwork, fx+113, fy+25, fx+334, fy+ 38, FILER_COL_4 );
box( egbwork, fx+118, fy+55, fx+327, fy+187, FILER_COL_4 );
if( type )
line( egbwork, fx+15+o*6, fy+147, fx+15+o*6, fy+156, FILER_COL_5 );
n = flag = 0;
MOS_awake;
}
if( ch && cmp( mx, fx+1, fx+16 ) && cmp( my, fy+1, fy+16 ) ){
MOS_sleep;
EGB_writeMode( egbwork, XOR );
button_on( egbwork, fx+1, fy+1, fx+16, fy+16 );
sleep( 10 );
button_off( egbwork, fx+1, fy+1, fx+16, fy+16 );
EGB_writeMode( egbwork, PSET );
putimage( egbwork, fx, fy, fx + 375, fy + 209, 10 );
MOS_awake;
return( 1 );
}
if( ch && cmp( mx, fx+24, fx+55 ) && cmp( my, fy+176, fy+191 ) ){
MOS_sleep;
font_kan_col( FILER_COL_4, FILER_COL_1 );
font_kan( strptn, page, POS( fx+28, fy+178 ), "実行", 0 );
sleep( 10 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+28, fy+178 ), "実行", 0 );
putimage( egbwork, fx, fy, fx + 375, fy + 209, 10 );
MOS_awake;
if( *name )
return( 0 );
else
return( 1 );
}
if( ch && cmp( mx, fx+72, fx+103 ) && cmp( my, fy+176, fy+191 ) ){
MOS_sleep;
font_kan_col( FILER_COL_4, FILER_COL_1 );
font_kan( strptn, page, POS( fx+76, fy+178 ), "取消", 0 );
sleep( 10 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_kan( strptn, page, POS( fx+76, fy+178 ), "取消", 0 );
putimage( egbwork, fx, fy, fx + 375, fy + 209, 10 );
MOS_awake;
return( 1 );
}
if( ch && cmp( mx, fx+17, fx+354 ) && cmp( my, fy+1, fy+16 ) ){
MOS_sleep;
x2 = mx - fx;
y2 = my - fy;
MOS_horizon( x2, 264 + x2 );
MOS_vertical( y2, 270 + y2 );
EGB_writeMode( egbwork, XOR );
frame( egbwork, fx, fy, fx + 375, fy + 209, FILER_COL_4 );
x1 = mx - x2;
y1 = my - y2;
MOS_rdpos( &ch, &x3, &y3 );
while( ch==1 ){
if( mx!=x3 || my!=y3 ){
frame( egbwork, x1, y1, x1 + 375, y1 + 209, FILER_COL_4 );
x1 = x3 - x2;
y1 = y3 - y2;
frame( egbwork, x1, y1, x1 + 375, y1 + 209, FILER_COL_4 );
}
mx = x3;
my = y3;
MOS_rdpos( &ch, &x3, &y3 );
}
frame( egbwork, x1, y1, x1 + 375, y1 + 209, FILER_COL_4 );
EGB_writeMode( egbwork, PSET );
MOS_horizon( 0, 639 );
MOS_vertical( 0, 479 );
if( fx!=x1 || fy!=y1 ){
putimage( egbwork, fx, fy, fx + 375, fy + 209, 10 );
fx = x1;
fy = y1;
flag = 1;
goto jump_b;
}
MOS_awake;
}
if( type ){
moji = key_read( &key_mode, 0 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
if( !key_mode )
font_kan( strptn, page, POS( fx+72, fy+128 ), "英小", 0 );
else if( key_mode==1 )
font_kan( strptn, page, POS( fx+72, fy+128 ), "英大", 0 );
else
font_kan( strptn, page, POS( fx+72, fy+128 ), "カナ", 0 );
if( moji ){
if( moji==BS ){
MOS_sleep;
font_ank( strptn, page, POS( fx+12+o*6, fy+146 ), " ", 0 );
*( name + o ) = 0x20;
*( name + o+1 ) = '\0';
if( o!=0 )
o--;
line( egbwork,fx+15+o*6,fy+147,fx+15+o*6,fy+156,FILER_COL_5 );
MOS_awake;
}
else if( moji>=0x20 ){
MOS_sleep;
*( name + o ) = moji;
*( name + o+1 ) = '\0';
key_buff[ 0 ] = moji;
key_buff[ 1 ] = 0;
font_ank( strptn, page, POS( fx+12+o*6, fy+146 ), key_buff, 0);
if( o!=11 )
o++;
line( egbwork,fx+15+o*6,fy+147,fx+15+o*6,fy+156,FILER_COL_5 );
MOS_awake;
}
}
}
goto loop;
}
void sort( int n )
{
char buff_a[ 15 ], buff_b;
int i, j, k, l;
long s;
i = 0;
while( f_attr[ i ]!=0 && i<=n-1 )
i++;
if( i>=n ){
i = j = k = 0;
goto jump;
}
j = k = i;
for( i=j;i<=n-1;i++ ){
if( f_attr[ i ]==1 ){
strcpy( buff_a, f_name[ k ] );
strcpy( f_name[ k ], f_name[ i ] );
strcpy( f_name[ i ], buff_a );
buff_b = f_attr[ k ];
f_attr[ k ] = f_attr[ i ];
f_attr[ i ] = buff_b;
s = file_size[ k ];
file_size[ k ] = file_size[ i ];
file_size[ i ] = s;
k++;
}
}
if( f_attr[ 0 ]==2 )
l = 1;
else
l = 0;
if( k<=l+1 )
goto jump;
for( j=l;j<=k-2;j++ ){
for( i=l;i<=k-2-j;i++ ){
if( strcmp( f_name[ i ], f_name[ i+1 ] )>=1 ){
strcpy( buff_a, f_name[ i+1 ] );
strcpy( f_name[ i+1 ], f_name[ i ] );
strcpy( f_name[ i ], buff_a );
s = file_size[ i+1 ];
file_size[ i+1 ] = file_size[ i ];
file_size[ i ] = s;
}
}
}
jump: ; ;
for( j=0;j<=n-2-k;j++ ){
for( i=k;i<=n-2-j;i++ ){
if( strcmp( f_name[ i ], f_name[ i+1 ] )>=1 ){
strcpy( buff_a, f_name[ i+1 ] );
strcpy( f_name[ i+1 ], f_name[ i ] );
strcpy( f_name[ i ], buff_a );
s = file_size[ i+1 ];
file_size[ i+1 ] = file_size[ i ];
file_size[ i ] = s;
}
}
}
}
void get_filename( int *n )
{
struct find_t file;
*n = 0;
if( _dos_findfirst( "*.*", _A_SUBDIR, &file )==0 ){
if( file.name[ 0 ]!='.' ){
strcpy( f_name[ *n ], file.name );
file_size[ *n ] = file.size;
if( file.attrib==16 )
f_attr[ *n ] = 1;
else
f_attr[ *n ] = 0;
*n += 1;
}
while( _dos_findnext( &file )==0 && *n<=1023 ){
strcpy( f_name[ *n ], file.name );
file_size[ *n ] = file.size;
if( file.attrib==16 )
f_attr[ *n ] = 1;
else
f_attr[ *n ] = 0;
*n += 1;
}
}
if( *n ){
if( f_name[ 0 ][ 0 ]=='.' )
f_attr[ 0 ] = 2;
sort( *n );
if( f_attr[ 0 ]==2 )
strcpy( f_name[ 0 ], "<<Directry_Up>>" );
}
}
void put_filename( char *strptn, int *j, int *k, int n )
{
char dir[37];
int i;
UINT a, b, c, c_drv;
ULONG d;
struct diskfree_t disk;
_dos_getdrive( &c_drv );
_dos_getdiskfree( c_drv, &disk );
a = disk.avail_clusters;
b = disk.sectors_per_cluster;
c = disk.bytes_per_sector;
d = a * b * c;
font_10( strptn, page, POS( fx+34, fy+98 ), ( int )d, 9, 1 );
_getcwd( crr_dir, 80 );
_rstrncpy( dir, crr_dir, 35 );
dir[ 35 ] = '\0';
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_mix( strptn, page, POS( fx+120, fy+26 ), dir, 34 );
if( n ){
n<=10 ? *j = *k = n-1 : *j = *k = 10;
for( i=0;i<=*j;i++ ){
if( f_attr[ i ]==1 ){
font_ank( strptn, page, POS( fx+120, fy+55+i*12 ),
"< >", 0 );
font_mix( strptn, page, POS( fx+128, fy+55+i*12 ),
f_name[i], 0 );
}
else
font_mix( strptn, page, POS( fx+120, fy+55+i*12 ),
f_name[i], 0 );
font_10( strptn,
page, POS( fx+280, fy+55+i*12 ), ( int )file_size[ i ], 8, 1 );
}
}
}
void display_filer( char *egbwork, char *strptn )
{
int i, j;
getimage( egbwork, fx, fy, fx + 375, fy + 209, 10 );
box( egbwork, fx , fy , fx + 375, fy + 209, FILER_COL_1 );
box( egbwork, fx + 1, fy + 19, fx + 372, fy + 206, FILER_COL_4 );
box( egbwork, fx + 176, fy + 1, fx + 354, fy + 17, FILER_COL_3 );
box( egbwork, fx + 353, fy + 1, fx + 372, fy + 17, FILER_COL_2 );
frame( egbwork, fx + 40, fy + 32, fx + 70, fy + 62, FILER_COL_1 );
frame( egbwork, fx + 40, fy + 32, fx + 71, fy + 63, FILER_COL_1 );
frame( egbwork, fx + 8, fy + 96, fx + 103, fy + 111, FILER_COL_1 );
frame( egbwork, fx + 8, fy + 144, fx + 103, fy + 159, FILER_COL_1 );
frame( egbwork, fx + 23, fy + 175, fx + 56, fy + 192, FILER_COL_1 );
frame( egbwork, fx + 21, fy + 173, fx + 58, fy + 194, FILER_COL_1 );
frame( egbwork, fx + 71, fy + 175, fx + 104, fy + 192, FILER_COL_1 );
frame( egbwork, fx + 112, fy + 24, fx + 335, fy + 39, FILER_COL_1 );
frame( egbwork, fx + 112, fy + 48, fx + 335, fy + 191, FILER_COL_1 );
button_off( egbwork, fx + 344, fy + 48, fx + 359, fy + 159 );
button_off( egbwork, fx + 344, fy + 160, fx + 359, fy + 175 );
button_off( egbwork, fx + 344, fy + 176, fx + 359, fy + 191 );
button_off( egbwork, fx + 16, fy + 32, fx + 31, fy + 63 );
button_off( egbwork, fx + 80, fy + 32, fx + 95, fy + 63 );
frame( egbwork, fx + 344, fy + 48, fx + 359, fy + 159, FILER_COL_1 );
frame( egbwork, fx + 344, fy + 160, fx + 359, fy + 175, FILER_COL_1 );
frame( egbwork, fx + 344, fy + 176, fx + 359, fy + 191, FILER_COL_1 );
frame( egbwork, fx + 16, fy + 32, fx + 31, fy + 63, FILER_COL_1 );
frame( egbwork, fx + 80, fy + 32, fx + 95, fy + 63, FILER_COL_1 );
frame( egbwork, fx + 354, fy + 7, fx + 366, fy + 15, FILER_COL_4 );
frame( egbwork, fx + 358, fy + 3, fx + 370, fy + 11, FILER_COL_4 );
line( egbwork, fx + 18, fy + 47, fx + 18, fy + 48, FILER_COL_1 );
line( egbwork, fx + 18, fy + 48, fx + 27, fy + 57, FILER_COL_1 );
line( egbwork, fx + 27, fy + 57, fx + 27, fy + 38, FILER_COL_1 );
line( egbwork, fx + 27, fy + 38, fx + 18, fy + 47, FILER_COL_1 );
line( egbwork, fx + 92, fy + 47, fx + 92, fy + 48, FILER_COL_1 );
line( egbwork, fx + 92, fy + 48, fx + 83, fy + 57, FILER_COL_1 );
line( egbwork, fx + 83, fy + 57, fx + 83, fy + 38, FILER_COL_1 );
line( egbwork, fx + 83, fy + 38, fx + 92, fy + 47, FILER_COL_1 );
line( egbwork, fx + 351, fy + 165, fx + 352, fy + 165, FILER_COL_1 );
line( egbwork, fx + 352, fy + 165, fx + 356, fy + 169, FILER_COL_1 );
line( egbwork, fx + 356, fy + 169, fx + 347, fy + 169, FILER_COL_1 );
line( egbwork, fx + 347, fy + 169, fx + 351, fy + 165, FILER_COL_1 );
line( egbwork, fx + 351, fy + 186, fx + 352, fy + 186, FILER_COL_1 );
line( egbwork, fx + 352, fy + 186, fx + 356, fy + 182, FILER_COL_1 );
line( egbwork, fx + 356, fy + 182, fx + 347, fy + 182, FILER_COL_1 );
line( egbwork, fx + 347, fy + 182, fx + 351, fy + 186, FILER_COL_1 );
paint( egbwork, fx + 24, fy + 47, FILER_COL_1 );
paint( egbwork, fx + 88, fy + 47, FILER_COL_1 );
paint( egbwork, fx + 352, fy + 167, FILER_COL_1 );
paint( egbwork, fx + 352, fy + 184, FILER_COL_1 );
button_off( egbwork, fx + 1, fy + 1 , fx + 16, fy + 16 );
for( j=0;j<=13;j++ ){
for( i=0;i<=13;i++ )
pset( egbwork, (i/2)*2+(j%2)+2+fx, j+2+fy, FILER_COL_4 );
}
font_kan_col( FILER_COL_4, FILER_COL_1 );
font_kan( strptn, page, POS( fx+32, fy+3 ), "ファイルセレクタ", 0 );
font_ank_col( FILER_COL_1, FILER_COL_4 );
font_kan_col( FILER_COL_1, FILER_COL_4 );
font_ank( strptn, page, POS( fx+36, fy+114 ), "Bytes Free", 0 );
font_kan( strptn, page, POS( fx+28, fy+178 ), "実行", 0 );
font_kan( strptn, page, POS( fx+76, fy+178 ), "取消", 0 );
}
// 書き込みの際に容量が足りるかチェックする関数
int capa_check( char *name, long size )
{
UINT a_c, s_p_c, b_p_s;
struct find_t file;
struct diskfree_t disk;
_dos_getdiskfree( 0, &disk );
a_c = disk.avail_clusters;
s_p_c = disk.sectors_per_cluster;
b_p_s = disk.bytes_per_sector;
if( _dos_findfirst( name, _A_NORMAL, &file )==0 ){
if( size>a_c*s_p_c*b_p_s+file.size )
return( 1 ); //容量が足りない
else
return( 0 ); //容量が足りる
}
else{
if( size>a_c*s_p_c*b_p_s )
return( 1 ); //容量が足りない
else
return( 0 ); //容量が足りる
}
}